import React, { Component } from 'react';
import { Modal, Toast } from 'antd-mobile';
import './OrderWithdrawalCard.less';

export default class OrderWithdrawalCard extends Component {


    withdrawal = () => {
        Modal.alert('提醒', `进行提现每笔会收取${2}元钱手续费,确定要申请提现吗？`,
            [
                { text: '取消', onPress: () => { } },
                {
                    text: '确定', onPress: () => {
                        React.$utils.request({
                            url: '/app/withdrawApply',
                            method: 'post',
                            data: {
                                sureMoney: this.props.info.sureMoney
                            }
                        }).then(res => {
                            Toast.success('申请成功');
                        })
                    }
                },
            ]
        )
    }

    render() {
        return (
            <div className='order-withdrawal-card'>
                <div className='card'>
                    <div className='card-item'>
                        <div>
                            <span style={{ marginRight: '0.2rem' }}>可提现</span>
                            <span style={{ color: '#f63e39' }}>{this.props.info.sureMoney}</span>
                        </div>
                        {/* <input type="number" className='withdrawal-input' value={180} /> */}
                        <div className='withdrawal-button' onClick={this.withdrawal}>提现</div>
                    </div>
                    <div className='card-item'>
                        <div>历史已提现(元)</div>
                        <div>{this.props.info.alreadyMoney}</div>
                    </div>
                </div>
            </div>
        );
    };
}